import sectionTitle from '@/components/section-title'
	import {
		getTime,
		getTimeInterval
	} from '@/utils'
	import {
		pageRemarks
	} from '@/api/remarks.js'
	import comment from '@/components/comment'
	import {
		publishRemark
	} from '@/api/remarks.js'
	// import Quote from "@/components/quote";
	// import {fetchFriend} from '../api'
	import messageEditor from "@/components/messageEditor.vue"
	export default {
		name: "message",
		data() {
			return {
				list: [],
				page: {
					pageSize: 10
				},
				remarks: [],
				remarks_total: 0,
				remark: {
					userImage: "",
					userName: "",
					email: "",
					content: ""
				},
			}
		},
		computed: {
			userInfo() {
				return this.$store.state.userInfo
			}
		},
		components: {
			// Quote,
			sectionTitle,
			comment,
			messageEditor
		},
		methods: {
			getRemarks(pageNo) {
				pageRemarks(pageNo, this.page.pageSize).then(res => {
					this.remarks = res.data.data;
					this.remarks_total = res.data.total;
				})
			},
			handleSizeChange(val) {
				this.getRemarks(val)
			},
			submitRemark(val) {
				console.log(val);
				var data = val;
				data.type = 2;
				publishRemark(data).then(res => {
					console.log(res)
					this.$message({
						message: '留言成功',
						type: 'success'
					});
					this.getRemarks(1);
				});
			}
		},
		mounted() {},
		created() {
			this.getRemarks(1);
		},
		//页面创建之初自动触发的事件
		beforeCreate() {
			this.$bus.emit("setIdx", 4);
		},
		beforeUpdate() {}
	}